/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package session;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import model.Project;

/**
 *
 * @author HuyNVK
 */
@Stateless
public class ProjectFacade extends AbstractFacade<Project> implements ProjectFacadeRemote {
    @PersistenceContext(unitName = "ejb-servPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public ProjectFacade() {
        super(Project.class);
    }

    @Override
    public Project merge(Project project) {
        return em.merge(project);        
    }

    @Override
    public void deleteByID(String id) {
        Project project = find(id);
        project = em.merge(project);
        em.remove(project);
    }

    @Override
    public void insert(Project project) {
        em.persist(project);
    }   
       
}
